#include<iostream>
#include<vector>
#include<list>
#include<map>
#include<string>
#include<array>
using namespace std;

#include<assert.h>
/* namespace bit
{
    template <class T>
    class vector
    {
    public:
        typedef T *iterator;
        vector(initializer_list<T> l)
        {
            _start = new T[l.size()];
            _finish = _start + l.size();
            _endofstorage = _start + l.size();
            iterator vit = _start;
            typename initializer_list<T>::iterator lit = l.begin();
            while (lit != l.end())
            {
                *vit++ = *lit++;
            }
            // for (auto e : l)
            //   *vit++ = e;
        }
        vector<T> &operator=(initializer_list<T> l)
        {
            vector<T> tmp(l);
            std::swap(_start, tmp._start);
            std::swap(_finish, tmp._finish);
            std::swap(_endofstorage, tmp._endofstorage);
            return *this;
        }

    private:
        iterator _start;
        iterator _finish;
        iterator _endofstorage;
    };
}

int main()
{
    auto il = {10, 20, 30};
    cout << typeid(il).name() << endl;
    return 0;
} */

struct Point
{
	int _x;
	int _y;
};

class Date
{
public:
	Date(int year, int month, int day)
		:_year(year)
		, _month(month)
		, _day(day)
	{
		cout << "Date(int year, int month, int day)" << endl;
	}
private:
	int _year;
	int _month;
	int _day;
};

/*  // 一切皆可用列表初始化，且可以不加=
int main()
{
	int a1[] = { 1, 2, 3, 4, 5 };
	int a2[5] = { 0 };

    Point p = { 1, 2 };
	int x2 = { 2 };
	Date d1 = { 2024, 7, 25 };
	const Date& d2 = { 2024, 7, 25 };

	
	return 0;
} */

/* int main()
{
//	// {} 必须跟Date构造参数个匹配
	Date d1 = { 2024, 7, 25};
//
	// {}列表中可以有任意多个值
	vector<int> v1 = { 2024, 7, 25, 4, 5};
	vector<int> v2({ 2024, 7, 25, 4, 5 });
	
	std::initializer_list<int> mylist;
	mylist = { 10, 20, 30 };
	cout << sizeof(mylist) << endl;

	cout << mylist.begin() << endl;
	cout << mylist.end() << endl;
	cout << &d1 << endl;

    map<string, string> dict = { {"sort0", "排序"}, {"sort1", "排序"}, {"sort2", "排序"} };

	return 0;
}  */

int main()
{
    // 静态数组越界的检查
    int a[10] = { 0 };

    cout << a[10] << endl;
    cout << a[11] << endl;

    // a[10] = 1;
    // a[11] = 1;

    a[15] = 1;

    // 越界检查很严格
    array<int, 10> arr;
    cout << arr[10] << endl;

    vector<int> v(10, 0);

    return 0;
}